// delete.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <afx.h>
void FindAndDelPDFFolder(CString strPath)
{
	CFileFind finder;
	BOOL bContinue = TRUE;

	if(strPath.Right(1) != _T("\\"))
		strPath += _T("\\");

	strPath += _T("*.*");
	bContinue = finder.FindFile(strPath);
	while(bContinue)
	{
		bContinue = finder.FindNextFile();

		if(finder.IsDots()) continue;

		if(finder.IsDirectory()) // Delete all sub item.
		{
			//FindAndDelPDFFolder(finder.GetFilePath());
			::RemoveDirectory((LPCTSTR)finder.GetFilePath());
			continue;
			//finder.Close();
		}
		//else // Delete file.
		//{
		//	::DeleteFile((LPCTSTR)finder.GetFilePath());
		//	finder.Close();
		//}
		finder.Close();
	}
	finder.Close();

    strPath = strPath.Left(strPath.ReverseFind('\\'));
	
 // ::RemoveDirectory((LPCTSTR)strPath);
}

int _tmain(int argc, _TCHAR* argv[])
{
	FindAndDelPDFFolder(argv[1]);
	return 0;
}

